import { MergeConfigType, MergeConfigItem } from '@/components/FormPro/props';
import { getEditOrDetailConfig } from '@/components/FormPro/util';

export const getFormFileds = (type: MergeConfigType) => {
  const formBaseList: MergeConfigItem[] = [
    {
      label: '表显统计里程',
      filed: 'sheet_mileage',
      ifShow({ formModel }) {
        return formModel.billType === 'biaoxian';
      },
      props: {
        col: {
          span: 24,
        },
      },
      edit: {
        props: {
          component: {
            placeholder: '请填写 表显统计里程',
            min: 0,
            hideButton: true,
          },
          formItem: {
            rules: [
              {
                required: true,
                trigger: 'change',
                message: '请填写 表显统计里程',
              },
            ],
          },
        },
        slots: {
          inComponentSlots: {
            suffix() {
              return 'KM';
            },
          },
        },
        component: 'a-input-number',
      },
    },
    {
      label: '系统统计里程',
      filed: 'system_mileage',
      ifShow({ formModel }) {
        return formModel.billType === 'beidou';
      },
      props: {
        col: {
          span: 24,
        },
      },
      edit: {
        props: {
          component: {
            placeholder: '请填写 系统统计里程',
            min: 0,
            hideButton: true,
          },
          formItem: {
            rules: [
              {
                required: true,
                trigger: 'change',
                message: '请填写 系统统计里程',
              },
            ],
          },
        },
        slots: {
          inComponentSlots: {
            suffix() {
              return 'KM';
            },
          },
        },
        component: 'a-input-number',
      },
    },
  ];

  return getEditOrDetailConfig(formBaseList, type);
};
